package com.letfox.ad.service.impl;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.letfox.ad.service.FINComprehensiveService;
import com.letfox.finance.model.FINAccount;
import com.letfox.finance.service.ComprehensiveService;
import com.letfox.finance.user.model.FinAccountRlUAccount;
import com.letfox.finance.user.service.FinAccountRlUAccountService;
import com.letfox.finance.service.AccountService;

@Service
public class FINComprehensiveServiceImpl implements FINComprehensiveService {
	
	@Autowired
	private ComprehensiveService comprehensiveService;
	@Autowired
	private FinAccountRlUAccountService finAccountRlUAccountService;
	@Autowired
	private AccountService accountService;
	
	@Override
	public Map<String, Object> accountDataConsumption(String finAccountId,
			String strTime, String endTime)throws Exception {
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
	    Date strDate=df.parse(strTime);
		Date endDate=df.parse(endTime);
		Map<String, Object> map=comprehensiveService.periodTime_incomeDetail(finAccountId, strDate, endDate);
		return map;
	}
	
	@Override
	public FINAccount getFinAccount(String accountId) throws Exception{
		FinAccountRlUAccount finAccountRlUAccount=finAccountRlUAccountService.selectByAccountId(accountId);
		FINAccount finAccount=accountService.selectById(finAccountRlUAccount.getFinAccountId());
		return finAccount;
	}


}
